home *** CD-ROM | disk | FTP | other *** search
/ Power Programmierung 2 / Power-Programmierung CD 2 (Tewi)(1994).iso / c / library / dos / screen / quikc21 / qwikc21.doc < prev    next >
Encoding:
Text File  |  1989-07-05  |  77.0 KB  |  2,118 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13.  
  14.  
  15.  
  16.  
  17.  
  18.  
  19.  
  20.  
  21.                              QWIKC SCREEN UTILITIES
  22.                                   USER'S GUIDE
  23.  
  24.                                    Version 2.1
  25.                                   June 1, 1989
  26.  
  27.  
  28.                          Conversion to Turbo C / MS C by
  29.                        Jordan Gallagher / Wisdom Research
  30.  
  31.  
  32.                Copyright (C) 1988,1989 Eagle Performance Software
  33.                               All Rights Reserved.
  34.  
  35.  
  36.  
  37.                                _______
  38.                           ____|__     |               (tm)
  39.                        --|       |    |-------------------
  40.                          |   ____|__  |  Association of
  41.                          |  |       |_|  Shareware
  42.                          |__|   o   |    Professionals
  43.                        -----|   |   |---------------------
  44.                             |___|___|    MEMBER
  45.    QWIKC Screen Utilities                           User's Guide, Version 2.1
  46.  
  47.  
  48.  
  49.                        T A B L E   O F   C O N T E N T S
  50.  
  51.         1. INTRODUCTION  . . . . . . . . . . . . . . . . . . . . . 3
  52.              Features  . . . . . . . . . . . . . . . . . . . . . . 3
  53.              Using the Manuals . . . . . . . . . . . . . . . . . . 3
  54.              Licensing . . . . . . . . . . . . . . . . . . . . . . 4
  55.              Customer Service  . . . . . . . . . . . . . . . . . . 4
  56.              ASP . . . . . . . . . . . . . . . . . . . . . . . . . 5
  57.  
  58.         2. GETTING STARTED . . . . . . . . . . . . . . . . . . . . 6
  59.              Distribution Files  . . . . . . . . . . . . . . . . . 6
  60.              Demonstration . . . . . . . . . . . . . . . . . . . . 6
  61.              Simple Programming  . . . . . . . . . . . . . . . . . 7
  62.              Functions . . . . . . . . . . . . . . . . . . . . . . 9
  63.  
  64.         3. BASIC TECHNIQUES  . . . . . . . . . . . . . . . . . . . 12
  65.              Cursor Mode Routines  . . . . . . . . . . . . . . . . 12
  66.              Cursor Location Routines  . . . . . . . . . . . . . . 13
  67.              EOS Marker  . . . . . . . . . . . . . . . . . . . . . 13
  68.              Scrolling . . . . . . . . . . . . . . . . . . . . . . 15
  69.              Pop-Up Windows  . . . . . . . . . . . . . . . . . . . 15
  70.              Memory Models and Libraries . . . . . . . . . . . . . 16
  71.  
  72.         4. ADVANCED TECHNIQUES . . . . . . . . . . . . . . . . . . 18
  73.              Virtual Screens . . . . . . . . . . . . . . . . . . . 18
  74.              Video Pages . . . . . . . . . . . . . . . . . . . . . 19
  75.              Video Modes . . . . . . . . . . . . . . . . . . . . . 20
  76.              Multi-tasking Environments  . . . . . . . . . . . . . 21
  77.              Interrupts  . . . . . . . . . . . . . . . . . . . . . 21
  78.  
  79.         5. HARDWARE DETECTION  . . . . . . . . . . . . . . . . . . 22
  80.              Display Combination Code  . . . . . . . . . . . . . . 22
  81.              Snow Checking . . . . . . . . . . . . . . . . . . . . 23
  82.              System Hardware . . . . . . . . . . . . . . . . . . . 24
  83.  
  84.         APPENDIX A: Video Mode Table . . . . . . . . . . . . . . . 25
  85.  
  86.         APPENDIX B: Cursor Mode Data . . . . . . . . . . . . . . . 27
  87.              Cursor Mode Tables  . . . . . . . . . . . . . . . . . 27
  88.              Cursor Emulation  . . . . . . . . . . . . . . . . . . 27
  89.  
  90.         APPENDIX C: Performance  . . . . . . . . . . . . . . . . . 30
  91.              Code Size . . . . . . . . . . . . . . . . . . . . . . 30
  92.              Speed . . . . . . . . . . . . . . . . . . . . . . . . 30
  93.  
  94.         APPENDIX D: Application Products . . . . . . . . . . . . . 32
  95.  
  96.         APPENDIX E: Revision History . . . . . . . . . . . . . . . 34
  97.  
  98.         APPENDIX F: References . . . . . . . . . . . . . . . . . . 35
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.                                        2
  106.    QWIKC Screen Utilities                           User's Guide, Version 2.1
  107.  
  108.  
  109.    1.  I N T R O D U C T I O N
  110.  
  111.  
  112.    FEATURES
  113.  
  114.    Welcome to QWIKC Screen Utilities!
  115.  
  116.    You have just obtained a copy of the highest performance screen writing
  117.    tools available today for Turbo C 2.0 (TC2), MicroSoft C 5.x and QuickC
  118.    1.x.  Both novice and professional programmers will appreciate these simple
  119.    and very powerful utilities that give you absolute control over your CRT
  120.    displays in all text modes.
  121.  
  122.    Here are some of the features you will discover:
  123.  
  124.      . Writes on all IBM compatible computers, displays and adapters including
  125.        MDA, CGA, EGA, MCGA, VGA, 8514/A, Hercules and 3270 PC.
  126.      . Superior video detection routine.
  127.      . Eliminates snow and flicker.
  128.      . Writes directly to the screen in absolute rather than relative
  129.        coordinates.
  130.      . Writes in all text modes and column modes.
  131.      . Writes on all video pages.
  132.      . Writes on virtual screens in RAM.
  133.      . Writes text and attribute, text only, or attribute only.
  134.      . Reads strings, characters and attributes.
  135.      . Uses end-of-string (EOS) marker for quick string chaining.
  136.      . Provides standardized cursor control for all adapters.
  137.      . Enhanced cursor movement.
  138.      . Compatible with DESQview and similar multitasking environments.
  139.      . Up to 2300% faster than TC2 cprintf direct video writing.
  140.      . Only 2.7k bytes of code if all 41 utilities are used.
  141.      . Optimized by the linker and drops unused code.
  142.      . Used in all other Eagle products.
  143.  
  144.  
  145.    QWIKC is a library providing capabilities not offered in the standard
  146.    writing routines that come with most C compilers.  In contrast to TC2's
  147.    standard library functions which do window-relative writing, QWIKC knows
  148.    how to write directly to the screen in absolute screen coordinates for any
  149.    video configuration.
  150.  
  151.  
  152.    USING THE MANUALS
  153.  
  154.    Disk Based Guides - The manuals for QWIKC are on disk so that you can
  155.    conveniently scan for the topic you are seeking.  You can do this with any
  156.    list or search utility with a search function.  You can also make a printed
  157.    copy.  If you have not already printed this manual, refer to the READ.ME
  158.    file for instructions.  At the present time, no bound manuals are being
  159.    offered with registration.
  160.  
  161.    User's Guide - This manual, the one you are reading now, assumes that as a
  162.    programmer you are already familiar with your C compiler, and that you have
  163.    a working knowledge of your disk operating system (DOS).  It will provide
  164.  
  165.  
  166.                                        3
  167.    QWIKC Screen Utilities                           User's Guide, Version 2.1
  168.  
  169.  
  170.    you the basic principles of direct screen writing and powerful tips on some
  171.    previously unavailable techniques.
  172.  
  173.    Reference Guide - This manual describes in detail all functions and
  174.    variables used in QWIKC.  It is alphabetically arranged for easy access in
  175.    a format similar to the TC2 manual.  Use this manual when you have become
  176.    familiar with the basic principles in the User's guide.
  177.  
  178.  
  179.    LICENSING
  180.  
  181.    Registration - These utilities and the documentation have been released for
  182.    distribution as Shareware.  You have been given the chance to sample the
  183.    full capability of QWIKC without risk!  If you find that QWIKC is a
  184.    valuable tool, then you are expected to register.  You will find a
  185.    reasonable licensing schedule found in LICENSE.ARC to meet private or
  186.    commercial needs.
  187.  
  188.    Source Code - All registered users will receive source code when the signed
  189.    license agreement is returned with the registration.
  190.  
  191.  
  192.    CUSTOMER SERVICE
  193.  
  194.    If you have questions, comments, or suggestions, the Eagle can be contacted
  195.    by four means - (1) CompuServe, (2) The Eagle BBS, (3) telephone, or
  196.    (4) mail.
  197.  
  198.    CompuServe - The most dependable way to contact the Eagle is through
  199.    CompuServe.  Jordan Gallagher has converted QWIKC from Turbo Pascal to C.
  200.    He can be contacted on the Borland Forum by typing GO BPROGB from the
  201.    CompuServe main menu.  You will enter the Forum for Turbo C.  You can
  202.    contact Jordan with his PPN number of 73557,2342.  Messages can also be
  203.    left through EasyPlex.
  204.  
  205.    The Eagle BBS - Our bulletin board system operates 24 hours a day, 7 days a
  206.    week at 1200 baud, using 8N1 at (214) 539-9878.  You can access our Pascal
  207.    and C products, and leave any questions or messages.
  208.  
  209.    Telephone - Jordan can also be reached by phone at (214) 539-7855 on
  210.    weekdays and Saturday from 10:00 a.m. to 9:00 p.m. CST.
  211.  
  212.    Mail - For registration or problems, please write:
  213.  
  214.        Eagle Performance Software
  215.        P.O. Box 292786
  216.        Lewisville, Texas 75029-2786
  217.  
  218.    In your written request for resolving problems, be sure to include:
  219.  
  220.      . A 5 1/4 inch diskette of compilable source code of the problem.
  221.      . The Eagle product and version number.
  222.      . The computer make and model.
  223.      . The type of video card, video monitor and keyboard.
  224.  
  225.  
  226.  
  227.                                        4
  228.    QWIKC Screen Utilities                           User's Guide, Version 2.1
  229.  
  230.  
  231.  
  232.  
  233.    ASP
  234.  
  235.    QWIKC is a Shareware program conforming to the standards of the Association
  236.    of Shareware Professionals (ASP).  You can get more information about ASP
  237.    by writing to:
  238.  
  239.        Association of Shareware Professionals
  240.        P.O. Box 5786
  241.        Bellevue, WA 98006.
  242.  
  243.    This program is produced by a member of the Association of Shareware
  244.    Professionals (ASP).  ASP wants to make sure that the shareware principle
  245.    works for you.  If you are unable to resolve a shareware-related problem
  246.    with an ASP member by contacting the member directly, ASP may be able to
  247.    help.  The ASP Ombudsman can help you resolve a dispute or problem with an
  248.    ASP member, but does not provide technical support for member's products.
  249.    Please write to:
  250.  
  251.        ASP Ombudsman
  252.        P.O. Box 5786
  253.        Bellevue,WA 98006
  254.  
  255.    or send a CompuServe message via EasyPlex to ASP Ombudsman 70007,3536.
  256.  
  257.  
  258.  
  259.  
  260.  
  261.  
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268.  
  269.  
  270.  
  271.  
  272.  
  273.  
  274.  
  275.  
  276.  
  277.  
  278.  
  279.  
  280.  
  281.  
  282.  
  283.  
  284.  
  285.  
  286.  
  287.  
  288.                                        5
  289.    QWIKC Screen Utilities                           User's Guide, Version 2.1
  290.  
  291.  
  292.    2.  G E T T I N G   S T A R T E D
  293.  
  294.    This section will acquaint you with the files on disk and show you a brief
  295.    demonstration.  You will also run your first program with QWIKC and then
  296.    become familiar with all of the utilities.
  297.  
  298.  
  299.    DISTRIBUTION FILES
  300.  
  301.    In this version, QWIKC21.ARC contains:
  302.  
  303.      QWIKC21S.LIB:  Small model QWIKC21 library file containing the
  304.                     object files.  There are 2000 lines of assembler
  305.                     code for the Small model, and 12000 lines total
  306.                     for all models.  Only the small model is supplied
  307.                     with the distribution copy. All models will be
  308.                     supplied upon registration.
  309.      QWIKC21 .H  :  Header file for QWIKC21S.LIB.  Contains external
  310.                     declarations of QWIKC's variables, macro
  311.                     definitions, and function prototypes.
  312.      QWIKC21 .DOC:  This document - a user's guide to QWIKC.
  313.      QWIKDEMO.C  :  A demonstration program showing the features and
  314.                     speed of all functions and is written primarily
  315.                     for color cards, but also works on mono cards.
  316.      QWIKDEMO.PRJ:  Project file for compiling QWIKDEMO.C.
  317.      QWIKREF .DOC:  QWIKC Reference Guide document covering each
  318.                     function and variable in detail.
  319.      QINITEST.C  :  A program that verifies the equipment detected by
  320.                     the qinit() function.
  321.      QINITEST.PRJ:  Project file for compiling QINITEST.C.
  322.      QBENCH  .C  :  A timing program that shows "screens/second" for
  323.                     typical QWIKC functions.
  324.      QBENCH  .PRJ:  Project file for compiling QBENCH.C.
  325.      TIMERD12.C  :  Source file for routine to measure elapsed time.
  326.      TIMERD12.H  :  Header file for routine to measure elapsed time.
  327.      LICENSE .ARC:  ARC file containing license agreements.
  328.      *       .BAT:  Batch files for compiling demo programs using
  329.                     MicroSoft C or QuickC.
  330.  
  331.    Registered users who have the source code will also have the following
  332.    files:
  333.  
  334.      QWIKC21T.LIB:  Tiny model QWIKC21 library.
  335.      QWIKC21C.LIB:  Compact model QWIKC21 library.
  336.      QWIKC21M.LIB:  Medium model QWIKC21 library.
  337.      QWIKC21L.LIB:  Large model QWIKC21 library.
  338.      QWIKC21H.LIB:  Huge model QWIKC21 library.
  339.  
  340.    There will also be six subdirectories containing the .ARC files for the
  341.    source on the disk for registered users.
  342.  
  343.  
  344.    DEMONSTRATION
  345.  
  346.    To get an overview of the speed and features of QWIKC, let's run a
  347.  
  348.  
  349.                                        6
  350.    QWIKC Screen Utilities                           User's Guide, Version 2.1
  351.  
  352.  
  353.    demonstration program that came with the utilities.  Do the following
  354.    steps:
  355.  
  356.      1. Using the small model, compile the QWIKDEMO program.  If you have
  357.         Turbo C, this is done using the project file QWIKDEMO.PRJ.  If you
  358.         have MicroSoft C or QuickC, use either CLQDEMO.BAT or QCLQDEMO.BAT,
  359.         respectively.  You must specify a parameter to these batch files
  360.         indicating the model size.
  361.      2. If you are running programs in a multi-tasking environment, instruct
  362.         the environment that you are NOT writing direct to the screen.  Also
  363.         set text pages to 2.
  364.      3. Run QWIKDEMO.
  365.      4. Press any key when the screen prompts you to continue with "... press
  366.         any key".
  367.  
  368.    Before doing the same thing with QINITEST.C, read the comments at the top
  369.    of the source file to see if you want to test for a computer submodel ID.
  370.    The batch files for QINITEST are CLQTEST.BAT and QCLQTEST.BAT.
  371.  
  372.  
  373.    SIMPLE PROGRAMMING
  374.  
  375.    Batch file or makefile (MSC/QC) - You should create either a batch file or
  376.    a makefile to compile your program.  A batch file should simply execute
  377.    your compiler and instruct it to link QWIKC21S.LIB.  Be sure to use the
  378.    small model.  For instructions on creating a makefile, see your compiler's
  379.    instructions.
  380.  
  381.    Project File (Turbo C) - All example programs in this manual assume that
  382.    QWIKC21S.LIB is being linked.  Your first project file may look like this:
  383.  
  384.        myqwik1
  385.        qwikc21s.lib
  386.  
  387.    First Program - Let's write a short program to see how simple it is to
  388.    write with QWIKC.  While in your editor, enter the following code:
  389.  
  390.      #include <stdio.h>
  391.      #include <conio.h>
  392.      #include "qwikc21.h"
  393.  
  394.      main() {
  395.          qinit();
  396.          qfill( 1, 1, crt_rows, crt_cols, LIGHTGRAY, ' ' );
  397.          qwrite( 5,  1, YELLOW+BLUE_BG, "QWIK writing" );
  398.          qwrite( 5, 13, YELLOW+BLUE_BG, " is easy!" );
  399.          getch();
  400.  
  401.          return;
  402.      }
  403.  
  404.    Save the file, then compile and run the program.  You can then see the text
  405.    "QWIK writing is easy!" starting on row 5, column 1.  On color monitors,
  406.    the text is a yellow foreground with a blue background while monochrome
  407.    monitors show high intensity on black.
  408.  
  409.  
  410.                                        7
  411.    QWIKC Screen Utilities                           User's Guide, Version 2.1
  412.  
  413.  
  414.  
  415.    Row/Col vs. X/Y - You probably noticed that the row parameter is first and
  416.    the column parameter is second.  Since QWIKC is entirely for text modes, it
  417.    is more intuitive to specify the row first and the column second just like
  418.    any word processor.  The X/Y scheme is better suited for graphics.
  419.  
  420.    Attributes - Notice that our example uses the macro BLUE_BG.  QWIKC
  421.    provides eight convenient background color macros to use along with the 16
  422.    foreground color macros.  The same names are used, but the "_BG" suffix is
  423.    added:
  424.  
  425.       BLACK_BG      RED_BG
  426.       BLUE_BG       MAGENTA_BG
  427.       GREEN_BG      BROWN_BG
  428.       CYAN_BG       LIGHTGRAY_BG
  429.  
  430.    These allow QWIKC to make the most of C's macros.  By simply adding the
  431.    foreground and background macros together, the compiler saves the result as
  432.    a single word.  And, by simply reading the qwrite statement, what you see
  433.    is what you get (WYSIWYG).
  434.  
  435.    Readable Code - As an added benefit, QWIKC was designed with human factors
  436.    in mind and was made so that it is very easy to read the code you create.
  437.    With the row, column, and attribute parameters first and the string last,
  438.    you can see that the two qwrite statements were easily aligned.  WYSIWYG to
  439.    the rescue again!
  440.  
  441.    Chaining - Notice that we had to calculate the string length of "QWIK
  442.    writing" before we could locate the string " is easy".  Let's modify the
  443.    last statement to indeed make it easier to locate the last string:
  444.  
  445.      #include <stdio.h>
  446.      #include <conio.h>
  447.      #include "qwikc21.h"
  448.  
  449.      main() {
  450.          qinit();
  451.          qfill( 1, 1, crt_rows, crt_cols, LIGHTGRAY, ' ' );
  452.          qwrite( 5, 1, YELLOW+BLUE_BG, "QWIK writing" );
  453.          qwriteeos(    YELLOW+BLUE_BG, " is easy!" );
  454.          getch();
  455.          return;
  456.      }
  457.  
  458.    Now that was really easy!  How did qwriteeos() know where to write?  QWIKC
  459.    internally keeps track of an end-of-string (EOS) marker so that any
  460.    subsequent "eos" function like qwriteeos() will chain the next string right
  461.    there - no rows or columns to calculate!  And you can chain as many as you
  462.    want on to any other QWIKC function.
  463.  
  464.    Same Attribute - But suppose we did not want to change the attribute that
  465.    was already on the screen and don't even know what it is.  How is that
  466.    done?  Just modify the attributes to the following:
  467.  
  468.      #include <stdio.h>
  469.  
  470.  
  471.                                        8
  472.    QWIKC Screen Utilities                           User's Guide, Version 2.1
  473.  
  474.  
  475.      #include <conio.h>
  476.      #include "qwikc21.h"
  477.  
  478.      main() {
  479.          qinit();
  480.          qfill( 1, 1, crt_rows, crt_cols, LIGHTGRAY, ' ' );
  481.          qwrite( 5, 1, SAMEATTR, "QWIK writing" );
  482.          qwriteeos(    SAMEATTR, " is easy!" );
  483.          getch();
  484.          return;
  485.      }
  486.  
  487.    The macro SAMEATTR (which is negative) tells QWIKC to simply enter the text
  488.    on the screen without changing the attribute.  The result of the program
  489.    shows the text with LIGHTGRAY on BLACK attributes.  This macro works on all
  490.    QWIKC utilities so that, when assigned to a variable, the attribute can
  491.    even be switched at runtime.
  492.  
  493.    Centering - Rather than having the text left-justified, let's center the
  494.    text on the screen by modifying a portion of the code:
  495.  
  496.      ...
  497.        qfill( 1, 1, crt_rows, crt_cols, LIGHTGRAY, ' ' );
  498.        qwritec( 5, 1, 80, SAMEATTR, "QWIK writing is easy!" );
  499.        return;
  500.      }
  501.  
  502.    This will place the text on row 5 centered between columns 1 and 80 which
  503.    is perfect for an 80 column text mode.  But what if other text or column
  504.    modes are used?  How can we ensure that it is always centered?  Only one
  505.    simple change is needed:
  506.  
  507.          ...
  508.          qfill( 1, 1, crt_rows, crt_cols, LIGHTGRAY, ' ' );
  509.          qwritec( 5, 1, crt_cols, SAMEATTR, "QWIK writing is easy!" );
  510.          return;
  511.      }
  512.  
  513.    The variable crt_cols always has the value of the column width that is
  514.    currently being used.  How does it know?  QWIKC is initialized at startup
  515.    by executing a function called qinit().  It detects a host of information
  516.    about your video configuration, everything from the type of video card you
  517.    are using to the shape of the cursor being used.  You can see a list of all
  518.    these variables available for your use in QWIKREF.DOC.
  519.  
  520.    qinit() - You probably have noticed that qinit() is the first function
  521.    called in every program.  This is essential before using any QWIKC
  522.    functions so that all CRT information can be correctly initialized.  If you
  523.    forget this, you can be certain your program will either crash or at least
  524.    misbehave!
  525.  
  526.  
  527.    FUNCTIONS
  528.  
  529.    Now that you have a basic idea of what QWIKC can do, let's make a brief
  530.  
  531.  
  532.                                        9
  533.    QWIKC Screen Utilities                           User's Guide, Version 2.1
  534.  
  535.  
  536.    survey of all the functions in QWIKC21S.LIB to just know what is available:
  537.  
  538.      One initializing function:
  539.  
  540.         qinit()            - Initializing function which sets the global
  541.                               variables for the QWIKC functions.  It
  542.                               should be called at the top of your program
  543.                               before calling any QWIKC functions.
  544.         qreinit()          - Should be called after a change from one text
  545.                               mode to another.
  546.  
  547.      Three quick direct screen writing functions, all work with or without
  548.      attribute change:
  549.  
  550.         qwrite()           - For any string.
  551.         qwritec()          - For any string; self-centering.
  552.         qwrite_sub()       - For any substring or part of a byte array.
  553.  
  554.      Four quick direct screen filling functions in rows-by-cols block
  555.      parameters:
  556.  
  557.         qfill()            - Repetitive filling with the same character;
  558.                              with or without attribute change.
  559.         qfillc()           - Same as qfill(), but self-centering.
  560.         qattr()            - Repetitive filling with an attribute only.
  561.         qattrc()           - Same as qattr(), but self-centering.
  562.  
  563.      Two quick screen storing functions:
  564.  
  565.         qstoretomem()      - Saves a rows-by-cols block to memory.
  566.         qstoretoscr()      - Restores a rows-by-cols block to any screen
  567.                              page.
  568.  
  569.      Two quick screen storing functions for copying blocks between a
  570.      screen (scr) and a virtual screen (vscr - a screen in memory):
  571.  
  572.         qscrtovscr()       - Copies a rows-by-cols block from QWIKC screen
  573.                              to virtual screen.
  574.         qvscrtoscr()       - Restores a rows-by-cols block from a virtual
  575.                              screen to the QWIKC screen.
  576.  
  577.      Three quick screen reading functions for reading data from any
  578.      screen:
  579.  
  580.          qreadstr()        - Reads a string of text.
  581.          qreadchar()       - Reads a single character.
  582.          qreadattr()       - Reads an attribute.
  583.  
  584.      Two quick scrolling functions work on any video page and also
  585.      virtual screens without flicker or snow:
  586.  
  587.          qscrollup()       - Scroll affected rows-by-cols block up.
  588.          qscrolldown()     - Scroll affected rows-by-cols block down.
  589.  
  590.      Two quick video page changing functions:
  591.  
  592.  
  593.                                        10
  594.    QWIKC Screen Utilities                           User's Guide, Version 2.1
  595.  
  596.  
  597.  
  598.          qviewpage()       - Changes the page to be displayed - up to 8!
  599.          qwritepage()      - Sets the page on which the QWIKC functions
  600.                              are writing.  You don't have to write just on
  601.                              the displayed page!
  602.  
  603.      Three quick cursor functions which work on any video page.  They now
  604.      work on the page being written rather than viewed:
  605.  
  606.          gotorc()          - Move cursor to absolute row and column
  607.                              coordinates rather than relative to a window.
  608.          wherer()          - Returns absolute cursor row.
  609.          wherec()          - Returns absolute cursor column.
  610.  
  611.      Eight quick EOS (end-of-string) marker functions that alter its
  612.      position and/or the cursor.  The marker can be moved on the CRT and
  613.      virtual screens, while the cursor movement is only on the page being
  614.      written:
  615.  
  616.          gotoeos()         - Moves cursor to EOS marker (like printf).
  617.          eosr()            - Returns absolute row of EOS marker.
  618.          eosc()            - Returns absolute col of EOS marker.
  619.          eostorc()         - Sets EOS to a given row and column.
  620.          eostorcrel()      - Relatively shifts EOS by a number of rows and
  621.                              columns, and can be negative or positive.
  622.          eostocursor()     - Matches EOS to the cursor position.
  623.          eosln()           - Moves EOS to column 1 of the next row.
  624.          qeosln()          - Like eosln(), but scrolls up if past last row.
  625.  
  626.      Three cursor routines alter the cursor mode:
  627.  
  628.          getcursor()       - Get current cursor mode from low memory.
  629.          setcursor()       - Sets new cursor mode.
  630.          modcursor         - Modifies cursor mode to on, off or erratic
  631.                              blink saving current scan lines.
  632.  
  633.      Four quick EOS writing function that chain write at the EOS marker:
  634.  
  635.          qwriteeos()       - like qwrite().
  636.          qwriteeos_sub()   - like qwrite_sub().
  637.          qfilleos()        - like qfill().
  638.          qattreos()        - like qattr().
  639.  
  640.      A submodel identification routine:
  641.  
  642.          get_submodel_id() - Optional function to find IBM submodel ID.
  643.  
  644.      A routine to set screen pointers to multi-tasking video buffers:
  645.  
  646.          setmultitask - Alters QWIKC to write to the multi-tasking buffer.
  647.    For a full description of each utility with its parameters, please refer to
  648.    QWIKREF.DOC for a summary of details and examples.
  649.  
  650.  
  651.  
  652.  
  653.  
  654.                                        11
  655.    QWIKC Screen Utilities                           User's Guide, Version 2.1
  656.  
  657.  
  658.    3.  B A S I C   T E C H N I Q U E S
  659.  
  660.  
  661.    CURSOR MODE ROUTINES
  662.  
  663.    Three Routines - If you have ever struggled with controlling the shape of
  664.    the cursor, your life is about to be made easier.  With just three
  665.    routines, setcursor(), getcursor(), and modcursor(), you can consistently
  666.    and reliably control the cursor mode (shape and visibility) on any video
  667.    card!
  668.  
  669.    Four Standard Modes - To make it even easier, four standard cursor mode
  670.    variables are initialized at startup to fit the exact requirements of the
  671.    detected video card.  They are:
  672.  
  673.      cursor_underline  - The standard underline cursor.
  674.      cursor_half_block - The half block shape usually used for insert editing.
  675.      cursor_block      - An easy to find full cell cursor.
  676.      cursor_initial    - The mode detected at start up.
  677.  
  678.    So, if we wanted a full block cursor, only one line of code is needed:
  679.  
  680.      setcursor( cursor_block );
  681.  
  682.    And that's it!  There's nothing else to figure out - even if you are using
  683.    something like 43-row mode on an EGA card.  When ending your programs, you
  684.    can get back to the original cursor mode by using:
  685.  
  686.      setcursor( cursor_initial );
  687.  
  688.    Hidden Cursor - Many programs need to hide the cursor altogether.  This can
  689.    be done with modcursor():
  690.  
  691.      modcursor( cursor_off );
  692.  
  693.    Why use modcursor() instead of setcursor()?  modcursor() leaves the shape
  694.    of the cursor alone, and only alters bits 13 and 14 of the cursor mode to
  695.    turn it on or off.  In fact there are three macros that are useful with
  696.    modcursor():
  697.  
  698.      cursor_off   (0x2000) - To turn the cursor off.
  699.      cursor_on    (0x0000) - To turn the cursor back on with the same shape.
  700.      cursor_blink (0x6000) - To create erratic blinking on MDA/CGA.  (On
  701.                              EGA/VGA, it turns the cursor off.)
  702.  
  703.    Using your imagination, you can also mix and match the macros and variables
  704.    by logically summing them.  Let's say we want to change the shape of the
  705.    cursor to a block while it is still turned off:
  706.  
  707.      setcursor( cursor_block | cursor_off );
  708.  
  709.    So, the next time modcursor( cursor_on ) is used, the cursor will be a full
  710.    block.  As a suggestion for terminating your program, be sure to restore
  711.    the cursor when exiting your program with:
  712.  
  713.  
  714.  
  715.                                        12
  716.    QWIKC Screen Utilities                           User's Guide, Version 2.1
  717.  
  718.  
  719.      setcursor( cursor_initial );
  720.  
  721.    getcursor() - This function simply returns the current cursor mode value
  722.    stored in low memory allowing you to save it for later use.
  723.  
  724.  
  725.    CURSOR LOCATION ROUTINES
  726.  
  727.    QWIKC has three routines that complement routines found in Turbo C -
  728.    gotorc(), wherer(), and wherec().  They correspond with Turbo C's gotoxy(),
  729.    wherex(), and wherex().  However, there are some important differences:
  730.  
  731.      . The QWIKC routines are absolute to the screen and are not
  732.        restricted by the Turbo C text window.
  733.      . The suffixes "r" and "c" mean row and column, so the parameters of
  734.        gotorc() are reversed from gotoxy().
  735.      . The QWIKC routines will also work on any video page. This is
  736.        explained in the Advanced Techniques section later.
  737.  
  738.    This is not the only way to move the cursor.  The EOS marker is also a very
  739.    powerful aid, as you will see in the next topic.
  740.  
  741.  
  742.    EOS MARKER
  743.  
  744.    Invisible Alternate Cursor - From the examples in the Simple Programming
  745.    topic, we found that we could easily chain two strings together using the
  746.    EOS marker.  In fact, this marker is so versatile, the EOS marker utilities
  747.    can be made interchangeable with the cursor, but much faster.  You could
  748.    think of it as an alternate cursor that is invisible.
  749.  
  750.    Keeping Track - Any time a QWIKC writing function is used, the EOS marker
  751.    is updated.  It is actually saved as the global variable qeosofs.
  752.    Technically, the value is the offset from the screen base and is a 0-based
  753.    byte count.  For example, if the following function was called:
  754.  
  755.      qwrite( 6, 5, YELLOW, "important data" );
  756.  
  757.    the EOS would be at row 6, column 19, right after the word "data".  The
  758.    value of qeosofs on an 80 column screen would be:
  759.  
  760.      qeosofs = ((row-1)*crt_cols + (col-1)) * 2 = 836
  761.  
  762.    QWIKC does not need to calculate this value, but simply saves it after
  763.    writing, so it is very efficient.  From the overview, you are already aware
  764.    of the four routines that will start writing at this marker - qwriteeos(),
  765.    qwriteeos_sub(), qfilleos(), and qattreos().  But what about changing the
  766.    location of the marker itself?  Keep reading.
  767.  
  768.    Moving the Marker - QWIKC has four routines that will manually move the EOS
  769.    marker:
  770.  
  771.      eostorc()    - Sets EOS to a given row and column.
  772.      eostorcrel() - Relatively shifts EOS by a number of rows and columns,
  773.                     and can be negative or positive.
  774.  
  775.  
  776.                                        13
  777.    QWIKC Screen Utilities                           User's Guide, Version 2.1
  778.  
  779.  
  780.      eosln()      - Moves EOS to column 1 of the next row.
  781.      qeosln()     - Like eosln, but scrolls up if past last row.
  782.  
  783.    The basic function eostorc() moves the EOS marker exactly like gotorc does
  784.    for the cursor.  But there are also several ways to move the marker rela-
  785.    tively.  Let's test a short program:
  786.  
  787.      #include <stdio.h>
  788.      #include <conio.h>
  789.      #include "qwikc21.h"
  790.  
  791.      main() {
  792.          qinit();
  793.          textcolor( YELLOW );
  794.          qfill( 1, 1, crt_rows, crt_cols, LIGHTGRAY, ' ' );
  795.          qwrite( 1, 1, YELLOW+BLUE_BG, "first  row ");
  796.          eosln();                                     /* Jump to (2,1) */
  797.          qwriteeos( YELLOW+BLUE_BG, "second row ");
  798.          eostorc( 3, 1 );                             /* Jump to (3,1) */
  799.          qwriteeos( YELLOW+BLUE_BG, "third  row ");
  800.          eostorcrel( 1, -4 );                         /* Jump to (4,8) */
  801.          qwriteeos( YELLOW+BLUE_BG, "etc." );
  802.          eostorc( eosr()+1, 8 );                      /* Jump to (5,8) */
  803.          qwriteeos( YELLOW+BLUE_BG, "etc." );
  804.          getch();
  805.          return;
  806.      }
  807.  
  808.    Save the file, then compile and run the program.  You should see "row" and
  809.    "etc." all aligned in one column.  So, you can see that there are several
  810.    simple ways to move the marker!
  811.  
  812.    EOS and the Cursor - You can also interface the EOS marker and the cursor
  813.    with two functions:
  814.  
  815.      gotoeos()      - Moves cursor to match the EOS marker.
  816.      eostocursor()  - Sets the EOS marker to match the cursor position.
  817.  
  818.    It can't get any simpler than that!  Now you can see that:
  819.  
  820.      qwrite( 1, 1, YELLOW, "test line" );
  821.      gotoeos();
  822.  
  823.    and,
  824.  
  825.      textcolor( YELLOW );
  826.      gotoxy( 1, 1 );
  827.      cprintf( "test line" );
  828.  
  829.    produce identical results.  But QWIKC is much faster!
  830.  
  831.  
  832.    SCROLLING
  833.  
  834.    Improved Control - With your compiler's routines, you can only control the
  835.  
  836.  
  837.                                        14
  838.    QWIKC Screen Utilities                           User's Guide, Version 2.1
  839.  
  840.  
  841.    full screen size with printf() or cprintf().  But with the two QWIKC
  842.    routines, qscrollup() and qscrolldown(), you can define any area to be
  843.    scrolled:
  844.  
  845.       qscrollup( 2, 2, crt_rows-2, crt_cols-2, myattr );
  846.  
  847.    This example scrolls a portion of the screen starting at (2,2) leaving a
  848.    one character border.  In a 25x80 text mode, it clears row 24 from column
  849.    2 to 79.  In addition, the cleared row attribute is myattr.
  850.  
  851.    Improved Performance - With qscrolldown() and qscrollup() (called qscroll*
  852.    for brevity), your programs can overcome the BIOS problems on many
  853.    machines.   Transparent to you, these functions work on all cards and
  854.    machines without flicker or snow and operate at three speeds:
  855.  
  856.      Maximum  - for video cards without snow
  857.      Fast CGA - for CGA cards on 80286 machines or better
  858.      Slow CGA - for CGA cards on 8086/8088 machines
  859.  
  860.    qinit() detects the CPU ID and video card to select the fastest algorithm.
  861.    All speeds use 16-bit transfers rather than 8-bit.  So, you can be assured
  862.    of the highest performance.
  863.  
  864.    Cursor Location - These routines do not move the cursor.  However, EOS is
  865.    pointing to the first column of the blank line and gotoeos() will move the
  866.    cursor there if needed.
  867.  
  868.    qeosln - This function is another alternative to full screen scrolling.  It
  869.    has the same function as eosln(), but will additionally scroll the screen
  870.    up if the EOS marker is past the last row.  Then it simply calls
  871.    qscrollup().  The attribute of the cleared row is the global variable
  872.    scroll_attr.  You must set this prior to using qeosln().
  873.  
  874.  
  875.    POP-UP WINDOWS
  876.  
  877.    QWIKC has the basic tools to create and remove pop-up windows.  Let's try
  878.    to create one.  While in your editor, enter the following code:
  879.  
  880.      #include <stdio.h>
  881.      #include <conio.h>
  882.      #include <dos.h>
  883.      #include "qwikc21.h"
  884.  
  885.      int mywindow[250],myunderlay[250];
  886.  
  887.      main() {
  888.          qinit();
  889.  
  890.          /* -- Fill the screen with a hatch character. -- */
  891.          qfill( 1, 1, crt_rows, crt_cols, LIGHTGRAY+BLACK_BG, 176 );
  892.  
  893.          /* -- Create a pop-up window. -- */
  894.          qstoretomem( 5, 12, 10, 25, myunderlay );        /* Save area to
  895.                                                              be covered    */
  896.  
  897.  
  898.                                        15
  899.    QWIKC Screen Utilities                           User's Guide, Version 2.1
  900.  
  901.  
  902.          qfill( 5, 12, 10, 25, BLACK+LIGHTGRAY_BG, ' ' ); /* Clear area    */
  903.          qwritec( 9, 12, 36, SAMEATTR, "Pop-up window" ); /* Label window  */
  904.          suspend( 1000 );                                 /* Wait a sec    */
  905.          qstoretomem( 5, 12, 10, 25, mywindow );          /* Save a copy   */
  906.          qstoretoscr( 5, 12, 10, 25, myunderlay );      /* Restore screen  */
  907.  
  908.          /* -- Move window some where else. -- */
  909.          qstoretomem( 8, 25, 10, 25, myunderlay ); /* Save area underneath */
  910.          qstoretoscr( 8, 25, 10, 25, mywindow );   /* Move window          */
  911.          suspend( 1000 );                          /* Wait a sec           */
  912.  
  913.          /* -- Remove window. -- */
  914.          qstoretoscr( 8, 25, 10, 25, myunderlay );  /* Restore screen      */
  915.          getch();
  916.  
  917.          return;
  918.      }
  919.  
  920.    Save the file.  You will see a 10 row by 25 column window located at
  921.    (5,12) which is row 5, column 12.  After one second, it will be moved to
  922.    (8,25). Then after another second, it is removed from the screen.  We did
  923.    a lot of work with very little code!
  924.  
  925.    Rows-by-Cols - qstoretoscr() and qstoretomem() are screen saving and
  926.    restoring functions that conveniently work in row-by-column blocks.  They
  927.    accommodate any column mode, so there is no need to be concerned about
  928.    screen width.
  929.  
  930.    Memory Requirements - Notice that qstoretomem() wrote the data direct to
  931.    memory in mywindow.  It is important that the memory allocated to that
  932.    variable is correct to prevent it from overwriting any other variables.
  933.    The array size chosen was a 250 word array which is a perfect fit since
  934.    one word is needed for each character and attribute on the screen.  If you
  935.    prefer, the heap can also be used such as:
  936.  
  937.      int *myunderlay;
  938.  
  939.      main() {
  940.          myunderlay=malloc(500);
  941.          qstoretomem( 5, 12, 10, 25, myunderlay );
  942.          /* ... */
  943.          free( myunderlay );
  944.      }
  945.  
  946.  
  947.    MEMORY MODELS AND LIBRARIES
  948.  
  949.    Separate Library Files - QWIKC comes with several .LIB (library) files.
  950.    The correct .LIB file for your memory model must be linked with your
  951.    program.  Here is a list of the .LIB files and their corresponding models:
  952.  
  953.      QWIKC21T.LIB - Tiny model
  954.      QWIKC21S.LIB - Small model
  955.      QWIKC21M.LIB - Medium model
  956.      QWIKC21C.LIB - Compact model
  957.  
  958.  
  959.                                        16
  960.    QWIKC Screen Utilities                           User's Guide, Version 2.1
  961.  
  962.  
  963.      QWIKC21L.LIB - Large model
  964.      QWIKC21H.LIB - Huge model
  965.  
  966.    Linking - If you have Turbo C, the library's name must be listed in your
  967.    project file.  For MicroSoft C or QuickC, instruct your compiler to link
  968.    the library when executing it.  You must also include QWIKC21.H in your
  969.    program so that the macros and function prototypes for QWIKC will be set
  970.    correctly.
  971.  
  972.    Libraries and Object Files - The library files that come with QWIKC
  973.    contain the object code for QWIKC's modules.  If it is necessary to
  974.    extract an object file, such as QWRITES from the Small model library,
  975.    enter the following at the DOS prompt:
  976.  
  977.        tlib qwikc21s *qwrites
  978.  
  979.    The file QWRITES.OBJ will be extracted and placed in the current
  980.    directory.  Since the linker optimizes the code anyway, this procedure
  981.    will probably not be necessary.
  982.  
  983.  
  984.  
  985.  
  986.  
  987.  
  988.  
  989.  
  990.  
  991.  
  992.  
  993.  
  994.  
  995.  
  996.  
  997.  
  998.  
  999.  
  1000.  
  1001.  
  1002.  
  1003.  
  1004.  
  1005.  
  1006.  
  1007.  
  1008.  
  1009.  
  1010.  
  1011.  
  1012.  
  1013.  
  1014.  
  1015.  
  1016.  
  1017.  
  1018.  
  1019.  
  1020.                                        17
  1021.    QWIKC Screen Utilities                           User's Guide, Version 2.1
  1022.  
  1023.  
  1024.    4.  A D V A N C E D   T E C H N I Q U E S
  1025.  
  1026.    This section will acquaint you with the powerful virtual screen writing
  1027.    features already built into QWIKC.  You will also find out how easy it is
  1028.    to work on multiple video pages and accommodate video mode changes.
  1029.  
  1030.  
  1031.    VIRTUAL SCREENS
  1032.  
  1033.    This topic will show you how to create and use powerful virtual screens.
  1034.  
  1035.    Virtual Screen - Just what is a virtual screen?  It is a screen maintained
  1036.    in RAM of any dimensions that can be reproduced on the CRT in full or in
  1037.    part.  The advantages are:
  1038.  
  1039.      . Variable row-by-column screen
  1040.      . Large video buffer up to 64k
  1041.      . High speed in RAM
  1042.      . Unlimited number of screens
  1043.  
  1044.    Screen Structure - QWIKC uses seven variables to define any screen.  When
  1045.    you call qinit() at the top of your program, QWIKC initializes them to the
  1046.    video system detected:
  1047.  
  1048.      crt_rows - Number of rows
  1049.      crt_cols - Number of columns
  1050.      crt_size - Byte allocation for screen
  1051.      qsnow    - True if snow checking needed
  1052.      qeosofs  - EOS offset
  1053.      qscrofs  - Screen offset
  1054.      qscrseg  - Screen segment
  1055.      qscrptr  - Far pointer to screen memory or virtual screen
  1056.  
  1057.    To make data access even easier, all these variables are contained in the
  1058.    structure qscr of type vscr_t.  In addition, qscrseg and qscrofs are
  1059.    actually macros pointing to the segment and offset of qscrptr.  This gives
  1060.    QWIKC a true far pointer, so screens can be anywhere in memory and not
  1061.    just paragraph aligned!
  1062.  
  1063.    Creating Virtual Screens - In three easy steps, you can easily create a
  1064.    virtual screen:
  1065.  
  1066.      1. Allocate memory for the screen.
  1067.      2. Save the current screen structure.
  1068.      3. Modify the screen structure for the virtual screen.
  1069.  
  1070.    Let's write some code that does just that:
  1071.  
  1072.      #include <stdio.h>
  1073.      #include <stdlib.h>
  1074.      #include <conio.h>
  1075.      #include "qwikc21.h"
  1076.  
  1077.      vscr_t crt,vscr;
  1078.  
  1079.  
  1080.  
  1081.                                        18
  1082.    QWIKC Screen Utilities                           User's Guide, Version 2.1
  1083.  
  1084.  
  1085.    main()
  1086.      {
  1087.          qinit();
  1088.  
  1089.          /* set up specs for virtual screen */
  1090.          vscr.vrows=80;                            /* let's choose 80 rows */
  1091.          vscr.vcols=100;                       /* let's choose 100 columns */
  1092.          vscr.vsize=vscr.vrows*vscr.vcols << 1;
  1093.          vscr.vsnow=0;                 /* flag can always be 0 on virtuals */
  1094.          vscr.veosofs=0;                  /* be safe and start at the base */
  1095.          vscr.vscrptr=malloc(vscr.vsize);  /* allocate heap space for vscr */
  1096.          crt=qscr;                                       /* save CRT specs */
  1097.          qscr=vscr;                    /* set current screen to our screen */
  1098.          /* ... */                          /* write to the virtual screen */
  1099.  
  1100.          qscr=crt;                         /* restore CRT specs when done! */
  1101.          return;
  1102.      }
  1103.  
  1104.    Now, when you use any QWIKC routine, they can be directed to the virtual
  1105.    screen - writing, reading, scrolling, wrapping, and everything you would
  1106.    expect.  qsnow can always be 0 when writing to virtual screens since RAM
  1107.    is used and not video card memory.
  1108.  
  1109.    Cursor Control - One thing not available to virtual screens is cursor
  1110.    movement, because the cursor location is reserved by DOS for just video
  1111.    pages.  That means there is no cursor available for virtual screens.  So,
  1112.    how can we get around this?  The EOS marker comes to the rescue as an
  1113.    indispensable cursor!  All EOS routines can still be used as before.
  1114.  
  1115.    Taking a Peek - At some time, we will need to take a look at all or a
  1116.    portion of the virtual screen by copying it to the CRT.  Two inter-screen
  1117.    functions do this by blocks at high speed - qscrtovscr() and qvscrtoscr().
  1118.    Here are the parameters of qvscrtoscr:
  1119.  
  1120.      qvscrtoscr( row, col, rows, cols, vrow, vcol, vwidth, vscrptr );
  1121.  
  1122.    Just like qstoretoscr(), row, col, rows, and cols describe the position
  1123.    and size on the screen (scr).  This screen is specified by qscr which is
  1124.    usually the CRT.  vscrptr points to the virtual screen (vscr).  Now, where
  1125.    is the same size block on vscr?  It's at vrow and vcol.  But the vscr may
  1126.    have a different column width than crt_cols.  So you specify that with
  1127.    vwidth.  Only the scr side checks for possible snow.  These functions are
  1128.    extremely fast, making virtual screens very practical.  See qscrtovscr()
  1129.    and qvscrtoscr() in QWIKREF.DOC for more examples.
  1130.  
  1131.    Multiple Virtual Screens - By changing qscr, you can even copy blocks from
  1132.    one virtual screen to another!  These routines do not affect qeosofs.
  1133.  
  1134.  
  1135.    VIDEO PAGES
  1136.  
  1137.    Multi-page Cards - Turbo C functions such as window and gotoxy, and C's
  1138.    printf are dedicated to just page 0, but many video cards have more than
  1139.    one page.  If you have a CGA or better, you already have memory on your
  1140.  
  1141.  
  1142.                                        19
  1143.    QWIKC Screen Utilities                           User's Guide, Version 2.1
  1144.  
  1145.  
  1146.    card for 4 to 8 pages.  Since the BIOS recognizes them as well, QWIKC
  1147.    gives you access to these extra pages.
  1148.  
  1149.    Page Control - qwritepage() and qviewpage() give you the power to use
  1150.    QWIKC on all video pages and display which ever you choose.  On a
  1151.    multiple-video page card like the CGA, you can simply code:
  1152.  
  1153.      qwritepage( mypage );
  1154.  
  1155.    to make all QWIKC routines be directed to your selected video page even
  1156.    though you could be viewing another page.  To view a page, you can in turn
  1157.    simply code:
  1158.  
  1159.      qviewpage( mypage );
  1160.  
  1161.    Tips About Pages - Here are some tips to keep in mind when using several
  1162.    video pages:
  1163.  
  1164.      . The highest valid video page is detected by qinit() and saved in
  1165.        the variable maxpage.
  1166.      . Invalid page parameters are just ignored.
  1167.      . The BIOS reserves a separate cursor location for each of up to 8
  1168.        video pages.
  1169.      . There is only one possible cursor mode, which is always displayed
  1170.        on the CRT.
  1171.      . The cursor location routines operate on the page being written
  1172.        rather than viewed.
  1173.      . The current video page viewed is in the variable videopage.
  1174.      . The current video page set by qwritepage() is saved in qvideo_page.
  1175.      . Be sure to end your programs with "qviewpage(0);".
  1176.  
  1177.  
  1178.    VIDEO MODES
  1179.  
  1180.    Changing Text Modes - Your application may require a change in video modes
  1181.    for different row or column modes.  If so, after the mode is changed, run
  1182.    qreinit() so the video variables will be correct.
  1183.  
  1184.    Text color - Be advised that a change of text modes with the textmode()
  1185.    function will also change your text color setting.  It is reset to normal,
  1186.    corresponding to a call to normvideo().
  1187.  
  1188.    Graphic Modes - If you need to alternate with a graphics mode, qreinit()
  1189.    does not need to be called provided you return back to the same text mode.
  1190.    Of course you may want to save the screen with qstoretomem() before
  1191.    switching to graphics.
  1192.  
  1193.    Changing Monitors - The technique to change monitors is to simply change
  1194.    the text mode.  This means qreinit() should be called.  Be sure to toggle
  1195.    the video mode bits in the equipment list byte at 0040h:0010h so other
  1196.    applications can behave properly.
  1197.  
  1198.    cursor_initial - When you call qinit() at the top of your program,
  1199.    cursor_initial saves what it detects for the current video mode.  When you
  1200.    call qrenit() after a text mode change, cursor_initial is also changed.
  1201.  
  1202.  
  1203.                                        20
  1204.    QWIKC Screen Utilities                           User's Guide, Version 2.1
  1205.  
  1206.  
  1207.    This may affect how you restore the cursor when terminating.  If needed,
  1208.    the value should be saved before using qreinit().
  1209.  
  1210.  
  1211.    MULTI-TASKING ENVIRONMENTS
  1212.  
  1213.    Multi-Tasking - QWIKC works very well with multi-tasking environments such
  1214.    as DESQview.  For examples on how to let QWIKC work in DESQview
  1215.    specifically, see a file called DESQC20.ARC (CIS: DSQC20.ARC) or a later
  1216.    version.
  1217.  
  1218.    setmultitask - A simple procedure has been included that generically
  1219.    detects the presence of DESQview, TopView, TaskView, OmniView, MS Windows
  1220.    or IBM 3270 PC multi-tasking video buffers (MTVB).  If they are being used,
  1221.    setmultitask will alter qscrptr, page0seg, and qsnow correctly.  This is a
  1222.    very simple task.  All of the *.C files included with the code show where
  1223.    the setmultitask declaration is to be placed early in the program.  If you
  1224.    are unsuccessful in getting it to work as you would expect, give us a call.
  1225.  
  1226.    inmultask - If setmultitask did indeed alter qscrptr for the MTVB, then
  1227.    inmultitask is set to 1.
  1228.  
  1229.    Multiple Video Pages - Be sure to instruct the multi-tasking environment
  1230.    of the number of video pages that are being used for your program.  Since
  1231.    some environments cannot correctly use multiple pages with the MTVB such as
  1232.    DESQview 2.01, it has been disabled in the demos with the use of
  1233.    inmultask.
  1234.  
  1235.    Cursor Routines and the BIOS - All cursor routines that change the mode and
  1236.    location use the BIOS.  This way multi-tasking environments can handle
  1237.    redirection properly.
  1238.  
  1239.  
  1240.    INTERRUPTS
  1241.  
  1242.    Within QWIKC - QWIKC only uses video interrupt 10h for qinit(), qreinit()
  1243.    and the cursor routines, so there no problem with DOS reentry.  Please read
  1244.    about "System Hardware" in Chapter 5 for more information on
  1245.    get_submodel_id() which uses INT 15h.
  1246.  
  1247.    Creating Handlers - If you use interrupt calls (like a clock display)
  1248.    within your program that use QWIKC routines, be sure to save and restore
  1249.    the value of qscr in the call so it won't return to the main program with
  1250.    unexpected results.  You should also be aware that main program may be
  1251.    writing to a virtual screen during the interrupt, so it is best that you
  1252.    initialize a copy of qscr solely for the interrupt.
  1253.  
  1254.  
  1255.  
  1256.  
  1257.  
  1258.  
  1259.  
  1260.  
  1261.  
  1262.  
  1263.  
  1264.                                        21
  1265.    QWIKC Screen Utilities                           User's Guide, Version 2.1
  1266.  
  1267.  
  1268.     5.  H A R D W A R E   D E T E C T I O N
  1269.  
  1270.  
  1271.    DISPLAY COMBINATION CODE
  1272.  
  1273.    qinit() function - qinit() initializes all the variables needed for the
  1274.    QWIKC functions, and specifically checks for ALL IBM video equipment
  1275.    including dual monitors.  qinit() MUST BE CALLED by your program before
  1276.    calling any QWIKC functions!  If you do not, you will get unexpected
  1277.    results.
  1278.  
  1279.    Display Combination Code (DCC) - The PS/2 video BIOS has a new function
  1280.    that simplifies equipment detection called the Read/Write Display
  1281.    Combination Code.  Using interrupt 10h with AH = 1A00h, the call will
  1282.    return the Active Display Device in BL and the Alternate Display Device in
  1283.    BH.  If the function is supported, it also returns 1Ah to AL.  For the
  1284.    possible Display Device codes which have been assigned by IBM, see
  1285.    QWIKREF.DOC.
  1286.  
  1287.    Conforming to DCC - No results are obtained for the DCC on anything other
  1288.    than PS/2 equipment.  However, to be consistent, qinit() was reprogrammed
  1289.    to conform to the DCC for ALL equipment.  To see if a CGA is in use, simply
  1290.    check to see if active_disp_dev=cga_color.  qinit() only sets the
  1291.    parameters for the active display.
  1292.  
  1293.    Dual Monitors - qinit() detects dual monitors and saves both the active and
  1294.    alternate display device codes.  The alternate display device code is for
  1295.    testing purposes only.  If you change monitors in a running program,
  1296.    qreinit() should be called.
  1297.  
  1298.    Testing for Dual Monitors - qinit() makes an attempt to detect for a second
  1299.    monitor by several means.  If no alternate cards like EGA or VGA are found,
  1300.    an alternate 6845 video chip (CGA, MDA, or Hercules) is checked.  If the
  1301.    chip is found, then further tests are made to find which card it could be.
  1302.    The chip existence test is highly reliable.  If no alternate display device
  1303.    is found, then alt_disp_dev=no_display.
  1304.  
  1305.    have_ps2 - qinit() sets have_ps2 to 1 if the DCC is supported.  This means
  1306.    that the program has detected a PS/2 video card whether it is integrated in
  1307.    a Model 30, a PS/2 Display Adapter installed on an IBM XT, or the like.  It
  1308.    also means that either MCGA or VGA is present, but not necessarily active.
  1309.    To know which, just check the DCC.
  1310.  
  1311.    have_3270 - If qinit() detects 3270 PC equipment/software, this variable is
  1312.    set to true.  In addition, the active_disp_dev is either mda_mono or
  1313.    cga_color.  Note: There may or may not be graphics capability in either
  1314.    case; qinit() is not meant to detect graphics.  If have_3270 is 1, then
  1315.    active_disp_dev_3270 will be set to the proper code.  On the 3270 PC, dual
  1316.    monitors are not possible as they use the same physical buffer space.  In
  1317.    addition, even though a color monitor may be used, there is only one video
  1318.    page unless there is a special adapter.  However, qinit() will determine if
  1319.    more than just one page is available.  The 3270 PC also does not support 40
  1320.    column modes.
  1321.  
  1322.    EGA Switches - By checking the value of this byte, you can determine the
  1323.  
  1324.  
  1325.                                        22
  1326.    QWIKC Screen Utilities                           User's Guide, Version 2.1
  1327.  
  1328.  
  1329.    monitor connected to the EGA, the alternate video system, and the start up
  1330.    default.  The byte is a copy of how the dip switches are set on the card
  1331.    where on=0 and off=1.  The primary is the default.  When the ECD is set for
  1332.    640x200, it is emulating the CD including the cursor mode.  qinit()
  1333.    directly tests for the alternate device rather than assuming it.
  1334.  
  1335.    EGA Information - The byte located at 0040h:0087h has hardware status
  1336.    information when the EGA (or VGA) is present.
  1337.  
  1338.    PC Convertible (PCC) - Since the PCC also does not support the DCC, a
  1339.    separate code is used.  If the 5140 LCD is used in mode 7, the Active
  1340.    Display Device is set to mda_mono which is close enough.  This set up can
  1341.    be verified by testing if maxpage=3.  The alternate display is found by
  1342.    using interrupt 10h with AH=15h.  The result is saved in alt_disp_dev_pcc.
  1343.    Of course the variable is undefined if a PCC is not used.
  1344.  
  1345.    Hercules - Hercules cards are also detected.  If either the active or
  1346.    alternate DCC is mda_mono, which is found by verifying a responsive 6845
  1347.    video chip at the mono register port, then an attempt is made to find if
  1348.    any Hercules card is attached.  If no Hercules card is found, then
  1349.    herc_model is no_herc; it is then assumed that just an MDA card is
  1350.    attached.  Because the test can take up to 1/3 of a second on slower
  1351.    computers, this test is only run once, even if you call qreinit().  The
  1352.    tests for the Hercules cards are the ones recommended by Hercules Computer
  1353.    Technology, which also admits that sometimes the tests will fail during
  1354.    multi-tasking activity. Hercules clones may not be detected by these tests,
  1355.    but the DCC will be correct.
  1356.  
  1357.  
  1358.    SNOW CHECKING
  1359.  
  1360.    CGA Snow - QWIKC is conservative with CGA cards and uses snow checking when
  1361.    the card is detected.  However, it is not needed in 40 column modes 0 and
  1362.    1.  qinit() was programmed to accommodate this.  For other hardware, you
  1363.    can change qsnow to suit your needs, but cardsnow should be left unchanged
  1364.    to save what qinit() detected.
  1365.  
  1366.    Zenith CGA - Zenith CGAs do not need wait-for-retrace.  If you would like
  1367.    to accommodate this, you can execute the following function after calling
  1368.    qinit() and after each qreinit():
  1369.  
  1370. void check_zenith(void)
  1371. {
  1372.     char tmp[10];
  1373.  
  1374.     movedata( 0xF000u, 0x800Cu, (unsigned)(((char far *)tmp)+1),
  1375.                                 (unsigned)((char far *)tmp),     8 );
  1376.     if(qsnow && (strncmp( tmp, "ZDS CORP", 8 )) == 0) {
  1377.         qsnow=0;
  1378.         cardsnow=0;
  1379.     }
  1380. }
  1381.  
  1382.    Critical Timing - The timing on the IBM PC (Intel 8088 at 4.77MHz) with a
  1383.    CGA is critical for storing characters and attributes with 16-bit transfers
  1384.  
  1385.  
  1386.                                        23
  1387.    QWIKC Screen Utilities                           User's Guide, Version 2.1
  1388.  
  1389.  
  1390.    because of the CPU architecture and slow speed.  Although previous versions
  1391.    kept the timing as tight as possible, there still remained a hint of snow
  1392.    in column 1.  This is due to the problem that RAM runs a little slower than
  1393.    BIOS ROM.  This problem has now been solved with a minor code change.  So
  1394.    the routines still run at the same speed, but there is absolutely no snow!
  1395.    I am not aware of any other routines that have done this as closely.
  1396.    (Computers with slower access RAM chips may still show up some variations
  1397.    from time to time.  Feedback is requested.)
  1398.  
  1399.  
  1400.    SYSTEM HARDWARE
  1401.  
  1402.    System ID - The basic computer system identification (or model) for IBM
  1403.    computers can be found by directly accessing the byte in memory at
  1404.    F000h:FFFEh.
  1405.  
  1406.    SubModel ID - After production of the AT, models were also given Submodel
  1407.    IDs.  To get both the model and submodel ID, you must use interrupt 15h
  1408.    with AH=C0h which only works on some computers.  A few PC and XT clones
  1409.    like the AT&T 6300 will actually crash when this interrupt is executed due
  1410.    to BIOS bugs.  So to prevent this from happening, the function only lets
  1411.    system IDs of FCh or less get the submodel_id.  In addition, it is a
  1412.    separate function called get_submodel_id() and is not a part of qinit().
  1413.    So you will have to execute it yourself to get a result.  The routine is
  1414.    entirely optional and is not required by QWIKC.
  1415.  
  1416.    CPU Identification - A CPU detection routine has been included for Intel
  1417.    processors.  It is useful for clones that do not recognize IBM's system ID
  1418.    scheme.  The idea came from Juan Jimenez as it appeared in Jan/Feb '88
  1419.    Turbo Technix magazine.  The routine has been simplified for reduced code
  1420.    (only 42 bytes) and enables use of simple macros.  This routine is required
  1421.    for qscrollup/down().
  1422.  
  1423.  
  1424.  
  1425.  
  1426.  
  1427.  
  1428.  
  1429.  
  1430.  
  1431.  
  1432.  
  1433.  
  1434.  
  1435.  
  1436.  
  1437.  
  1438.  
  1439.  
  1440.  
  1441.  
  1442.  
  1443.  
  1444.  
  1445.  
  1446.  
  1447.                                        24
  1448.    QWIKC Screen Utilities                           User's Guide, Version 2.1
  1449.  
  1450.  
  1451.    A P P E N D I X   A :   V I D E O   M O D E   T A B L E
  1452.  
  1453.  
  1454.    Video Modes - To help you figure out how all the IBM video systems are
  1455.    configured, it is helpful to have a table of all the possible Alphanumeric
  1456.    (A/N or text) modes.  QWIKC was not designed for the All Points Addressable
  1457.    (APA or graphics) modes.
  1458.  
  1459.              TABLE 1: Hardware Specific Video Mode Characteristics
  1460. -------------------------------------------------------------------------------
  1461. Mode Format Segment Display Box  MDA CGA EGA MCGA VGA PCjr PCC 3270 HGC maxpage
  1462. ---- ------ ------- ------- ---- --- --- --- ---- --- ---- --- ---- --- -------
  1463. 0,1  40x25  B800:0  320x200 8x8       x   x   x    x   x    x              7
  1464.                     320x350 8x14          x        x                       7
  1465.                     320x400 8x16              x                            7
  1466.                     360x400 9x16                   x                       7
  1467. 2,3  80x25  B800:0  640x200 8x8       x                x    x              3
  1468.                     640x200 8x8           x        x                       7 *
  1469.                     640x350 8x14          x        x                       7 *
  1470.                     640x400 8x16              x                            7
  1471.                     720x350 9x14                                x          0+
  1472.                     720x400 9x16                   x                       7
  1473. 7    80x25  B000:0  720x350 9x14  x                         x   x    x     0
  1474.                     720x350 9x14          x        x                       7 *
  1475.                     720x400 9x16                   x                       7
  1476.                     640x200 8x8                             x              3
  1477. -------------------------------------------------------------------------------
  1478.  
  1479.      Legend:
  1480.      Format  - Characters per row by the number of rows in the data area.
  1481.      Segment - Address of the first character on page 0 of the display
  1482.                buffer.
  1483.      Display - The pixel resolution for the data area excluding the
  1484.                border, horizontal by vertical.
  1485.      Box     - The pixel resolution for each character, horizontal by
  1486.                vertical.
  1487.      MDA     - Monochrome Display and Printer Adapter
  1488.      CGA     - Color Graphics Adapter
  1489.      EGA     - Enhanced Graphics Adapter
  1490.      PGC     - Professional Graphics Controller
  1491.      MCGA    - Multi-Color Graphics Array
  1492.      VGA     - Video Graphics Array
  1493.      PCjr    - PC Junior
  1494.      PCC     - PC Convertible
  1495.      HGC     - Hercules Graphics Cards - HGC, HGC Plus, and InColor Card
  1496.      3270    - All IBM 3270 PC adapters
  1497.      maxpage - 0-based highest page number; e.g. 7 means there are 8
  1498.                pages.
  1499.      MD      - 5151 Monochrome Display
  1500.      CD      - 5153 Color Display
  1501.      ECD     - 5154 Enhanced Color Display
  1502.  
  1503.      Notes:
  1504.      1. The 0 and 2 modes suppress color burst only on composite displays
  1505.         (not RGB) only for CGA and EGA.
  1506.  
  1507.  
  1508.                                        25
  1509.    QWIKC Screen Utilities                           User's Guide, Version 2.1
  1510.  
  1511.  
  1512.      2. The PS/2 model 25 and 30 have an integrated MCGA.  The model
  1513.         30/286, model 50 and above have an integrated VGA.
  1514.      3. The 8514 High Content Color Display along with the 8514/A adapter
  1515.         produces a superset of the VGA for APA, but there are no
  1516.         differences in the A/N modes to the VGA when the adapter is in
  1517.         "VGA" mode.  See IBM documentation for Advanced Function Mode.
  1518.      4. maxpage is reduced to 3 if EGA only has 64K graphics memory
  1519.         installed for modes marked "*".  maxpage of 7 is for 128K or more.
  1520.      5. The PCC can have either an alternate MDA or CGA.  The LCD (model
  1521.         5140) can emulate either the MDA or CGA modes, but the MDA mode is
  1522.         640x200.
  1523.      6. No information is provided on the PGC.
  1524.  
  1525.  
  1526.  
  1527.  
  1528.  
  1529.  
  1530.  
  1531.  
  1532.  
  1533.  
  1534.  
  1535.  
  1536.  
  1537.  
  1538.  
  1539.  
  1540.  
  1541.  
  1542.  
  1543.  
  1544.  
  1545.  
  1546.  
  1547.  
  1548.  
  1549.  
  1550.  
  1551.  
  1552.  
  1553.  
  1554.  
  1555.  
  1556.  
  1557.  
  1558.  
  1559.  
  1560.  
  1561.  
  1562.  
  1563.  
  1564.  
  1565.  
  1566.  
  1567.  
  1568.  
  1569.                                        26
  1570.    QWIKC Screen Utilities                           User's Guide, Version 2.1
  1571.  
  1572.  
  1573.    A P P E N D I X   B :   C U R S O R   M O D E   D A T A
  1574.  
  1575.    Each video card differs in character cell size and cursor emulation in
  1576.    different video modes.  The following data will show you the specific
  1577.    differences between modes and cards, and how QWIKC handles them.
  1578.  
  1579.  
  1580.    CURSOR MODE TABLES
  1581.  
  1582.    Cursor Mode Word - The cursor mode is saved in low memory at 0040h:0060h
  1583.    after each mode change.  Using hex is the easiest way to analyze the word.
  1584.    The shape of the cursor is defined by horizontal scan lines in the
  1585.    character cell where the top row of any cell is 0.
  1586.  
  1587.                           TABLE 2: Cursor Mode Word
  1588.               -------------------------------------------------
  1589.                       Hi byte                  Lo byte
  1590.               -----------------------   -----------------------
  1591.      Bit #:   15 14 13 12 11 10 09 08   07 06 05 04 03 02 01 00
  1592.      Bit #:   07 06 05 04 03 02 01 00   07 06 05 04 03 02 01 00
  1593.      Symbol:      $  $  *  *  *  *  *       @  @  +  +  +  +  +
  1594.  
  1595.      Key:     $ - controls cursor on/off and erratic blinking
  1596.               * - controls top scan line (0-based)
  1597.               @ - controls skew to the right
  1598.               + - controls bottom scan line (0-based)
  1599.  
  1600.  
  1601.    Skew - Bits 5 and 6 control the skew or shift to the right of the cursor on
  1602.    EGA/VGA cards.  Consistent results between video cards are not possible so
  1603.    it is best to leave these bits at zero.
  1604.  
  1605.    Cell Sizes - Because of different cells sized with different video cards,
  1606.    the top and bottom scan lines are also different for each card.  See TABLE
  1607.    1 in Appendix A for specific cell sizes.
  1608.  
  1609.                     TABLE 2: Cursor Mode Defaults
  1610.      ----------------------------------------------------------
  1611.      Adapter   Default  Comments
  1612.      --------  -------  ---------------------------------------
  1613.      MDA       0B0Ch
  1614.      CGA,MCGA  0607h
  1615.      EGA       0B0Ch    MD, ECD (640x350 25-line) Emulation off
  1616.      EGA       0607h    CD, ECD (640x200)
  1617.      VGA       0D0Eh    Emulation off
  1618.      3270 PC   0D0Dh    And converts MDA and CGA
  1619.  
  1620.  
  1621.    CURSOR EMULATION
  1622.  
  1623.    Cursor Emulation - qinit() sets the four standard cursor mode variables at
  1624.    startup to be either MDA or CGA defaults.  Almost all emulation modes can
  1625.    be handled by either of these two cell sizes.  qinit() handles certain
  1626.    exceptions.  If you want to handle your own exceptions, the following notes
  1627.    will help you.
  1628.  
  1629.  
  1630.                                        27
  1631.    QWIKC Screen Utilities                           User's Guide, Version 2.1
  1632.  
  1633.  
  1634.  
  1635.    cursor_blink - This mode is hardware specific.  It works on MDA and CGA
  1636.    while it turns the cursor off on EGA and VGA.
  1637.  
  1638.    MCGA/VGA Cursor Mode - On these two cards, you can both read and write the
  1639.    cursor mode direct from the CRTC.  To be compatible with all video cards,
  1640.    QWIKC does not attempt to do this, but instead depends on the Video Display
  1641.    Data Area at 0040h:0060h.  qinit() turns on the cursor emulation mode if
  1642.    PS/2 video equipment is detected.
  1643.  
  1644.    EGA Cursor Emulation - In 25-line mode on the EGA, cursor emulation works
  1645.    fairly well.  In other line modes, the emulation falters.  So qinit()
  1646.    forces emulation to be turned on in 25-line mode and off in other modes.
  1647.    On the EGA, emulation is turned off by setting bit 0 of egainfo to 1.  The
  1648.    standard QWIKC cursor modes are still set appropriately.
  1649.  
  1650.    MCGA Cursor Emulation - Use the CGA cursor cell size even though the
  1651.    character cell is 8x16.  The BIOS multiplies the start and end rows by 2
  1652.    and then adds one to the end row before writing to the hardware video port
  1653.    to emulate the CGA.
  1654.  
  1655.    VGA Cursor Emulation - qinit() turns the cursor emulation mode on so you
  1656.    don't have to worry about special fonts and cell sizes as it emulates the
  1657.    MDA and CGA.  The video BIOS will adjust your cursor shape to fit in the
  1658.    current cell size.  For the algorithms specific to the VGA, refer to the
  1659.    "IBM Personal System/2 and Personal Computer BIOS Interface Technical
  1660.    Reference Manual".
  1661.  
  1662.    3270 PC Peculiarities - The 3270 PC cursor types are limited to only three.
  1663.    In addition, the underline cursor is not visible on a white background on
  1664.    the 5272 color display and it is advisable to use a block cursor together
  1665.    with that attribute.  Notice that half-block cursors are converted to full
  1666.    block:
  1667.  
  1668.                      TABLE 3: 3270 PC Cursor Modes
  1669.      --------------------------------------------------------------
  1670.      Cursor Type   Comments
  1671.      ------------  ------------------------------------------------
  1672.      Underline     0D0Dh only.  CGA and MDA are emulated.
  1673.      Hidden (off)  cursor start > cursor end.  2000h is preferred.
  1674.      Block         anything other than the above
  1675.  
  1676.  
  1677.    Start Up Cursor Modes - Once QWIKC determines the cell size and the cursor
  1678.    emulation mode, the four standard cursor modes, cursor_initial,
  1679.    cursor_underline, cursor_halfblock and cursor_block are calculated:
  1680.  
  1681.        cursor_initial - This is the cursor mode detected at startup.  An
  1682.        improper default for MDA is automatically overridden to an
  1683.        underline.  Some early PCs have a BIOS bug that sets the MDA
  1684.        default incorrectly.
  1685.  
  1686.        cursor_underline - The lower scan line is set to: (bottom of
  1687.        cell-1).  The upper scan line is set to: (lower scan-1).
  1688.  
  1689.  
  1690.  
  1691.                                        28
  1692.    QWIKC Screen Utilities                           User's Guide, Version 2.1
  1693.  
  1694.  
  1695.        cursor_half_block - The top scan line is set to: (bottom of
  1696.        cell+1)/2.  This may appear a little fat for EGAs in 25-line mode,
  1697.        but is just right for all other cards and modes.
  1698.  
  1699.        cursor_block - Produces a block cursor by setting the top scan line
  1700.        to zero of cursor_underline.
  1701.  
  1702.  
  1703.  
  1704.  
  1705.  
  1706.  
  1707.  
  1708.  
  1709.  
  1710.  
  1711.  
  1712.  
  1713.  
  1714.  
  1715.  
  1716.  
  1717.  
  1718.  
  1719.  
  1720.  
  1721.  
  1722.  
  1723.  
  1724.  
  1725.  
  1726.  
  1727.  
  1728.  
  1729.  
  1730.  
  1731.  
  1732.  
  1733.  
  1734.  
  1735.  
  1736.  
  1737.  
  1738.  
  1739.  
  1740.  
  1741.  
  1742.  
  1743.  
  1744.  
  1745.  
  1746.  
  1747.  
  1748.  
  1749.  
  1750.  
  1751.  
  1752.                                        29
  1753.    QWIKC Screen Utilities                           User's Guide, Version 2.1
  1754.  
  1755.  
  1756.    A P P E N D I X   C :   P E R F O R M A N C E
  1757.  
  1758.  
  1759.    CODE SIZE
  1760.  
  1761.    If you use a QWIKC function, only the corresponding object file containing
  1762.    that function will be linked, thus optimizing the code.  Even if all func-
  1763.    tions are used, QWIKC is still quite small at a total of approx. 2681
  1764.    bytes.  Here's the linked code size for the small model (size varies
  1765.    slightly between models):
  1766.  
  1767.      FILE NAME    BYTES  FUNCTIONS
  1768.      ------------ -----  -------------------------------------------------
  1769.      qinit   .obj  608   qinit, qreinit
  1770.      qwrites .obj  282   qwrite, qwritec, qwriteeos
  1771.      qfills  .obj  451   qfill, qattr, qfillc, qattrc, qfilleos, qattreos
  1772.      qstores .obj  321   qstoretoscr, qstoretomem, qscrtovscr, qvscrtoscr
  1773.      qreads  .obj  131   qreadstr, qreadchar, qreadattr
  1774.      qscrolls.obj  271   qscrollup, qscrolldown
  1775.      qpages  .obj   59   qwritepage, qviewpage
  1776.      cursor  .obj   92   gotorc, wherer/c, setcursor, getcursor, modcursor
  1777.      eos     .obj  124   gotoeos, eosr/c, eostorc/rel, eostocursor, eosln
  1778.      qeosln  .obj   38   qeosln
  1779.      cpuident.obj   42   getcpuid
  1780.      getsubid.obj   27   get_submodel_id
  1781.      setmulti.obj   29   setmultitask
  1782.      qwrsub  .obj  206   qwrite_sub, qwriteeos_sub
  1783.  
  1784.    SPEED
  1785.  
  1786.    How fast is fast?  To have a basis for comparison, a unit of
  1787.    "screens/second" is used to get a feeling for speed.  To make one screen, a
  1788.    function is repeated with a FOR loop to fill several 80x25 pages and timed.
  1789.    The qwrite*() functions use 80 character strings, and qattr() and qfill()
  1790.    use 25 rows and 80 cols.  Here are some samples from the systems that have
  1791.    been tested.  16-bit video cards such as the one in the Compaq 386/20 will
  1792.    be much faster than 8-bit cards.
  1793.  
  1794.      --------------------- S C R E E N S / S E C O N D ---------------------
  1795.                 Chng  XT(4.77 MHz)  M30    M50    M70    ATT+  Compaq
  1796.      Function   Attr  MDA     CGA   MCGA   VGA    VGA    CGA   386/20
  1797.      ---------  ----  ------------  -----  -----  -----  ----  ------
  1798.      qwrite-     Yes   29.1   9.5    64.4   83.7  103.7  16.8   383.1
  1799.                  No    34.1   9.6    77.4  128.5  157.7  16.8   403.8
  1800.      qfill-      Yes  100.5  12.0   164.5  146.7  151.4  21.5   585.3
  1801.  
  1802.                  No    78.2   7.5   143.9  230.9  256.7  13.9   587.5
  1803.      qattr-      Yes   78.2   7.5   143.9  230.9  256.7  14.0   576.0
  1804.      qstore-     n/a   67.0   7.3   124.4  137.0  140.2  13.8   355.3
  1805.      qscroll-    n/a   55.6   3.8    90.3   76.5   77.7  16.8   322.1
  1806.  
  1807.    Be sure to test QBENCH.C for virtual screens and find another significant
  1808.    increase in speed.  All routines will be at least 100 Scr/Sec, and 500
  1809.    Scr/Sec is typical.
  1810.  
  1811.  
  1812.  
  1813.                                        30
  1814.    QWIKC Screen Utilities                           User's Guide, Version 2.1
  1815.  
  1816.  
  1817.    For those interested in comparisons, QWIKC's qwrite function is much faster
  1818.    than TC2 direct video writing routines by the following percentage:
  1819.  
  1820.      Function   CGA cards  All other cards
  1821.      ---------  ---------  ----------------
  1822.      cprintf     225%       900% to 2300%
  1823.  
  1824.  
  1825.  
  1826.  
  1827.  
  1828.  
  1829.  
  1830.  
  1831.  
  1832.  
  1833.  
  1834.  
  1835.  
  1836.  
  1837.  
  1838.  
  1839.  
  1840.  
  1841.  
  1842.  
  1843.  
  1844.  
  1845.  
  1846.  
  1847.  
  1848.  
  1849.  
  1850.  
  1851.  
  1852.  
  1853.  
  1854.  
  1855.  
  1856.  
  1857.  
  1858.  
  1859.  
  1860.  
  1861.  
  1862.  
  1863.  
  1864.  
  1865.  
  1866.  
  1867.  
  1868.  
  1869.  
  1870.  
  1871.  
  1872.  
  1873.  
  1874.                                        31
  1875.    QWIKC Screen Utilities                           User's Guide, Version 2.1
  1876.  
  1877.  
  1878.    A P P E N D I X   D :   A P P L I C A T I O N   P R O D U C T S
  1879.  
  1880.  
  1881.    Eagle Performance Software has developed identical products for both Turbo
  1882.    C and Turbo Pascal.  Our pledge is to provide you quality products with
  1883.    unparalleled performance and ease of use.
  1884.  
  1885.  
  1886.    QWIK
  1887.  
  1888.    QWIK - For direct screen video, QWIK is the highest performance screen
  1889.    writing tool available today for all text modes in any video configuration.
  1890.    QWIK provides capabilities far beyond those in the unit/library that comes
  1891.    with your compiler.
  1892.  
  1893.    Here are the product versions:
  1894.  
  1895.       File name     CIS filename  Compiler  Release date
  1896.       ------------  ------------  --------  ------------
  1897.       QWIK42B.ARC   QWIK42.ARC    TP4/5      10-01-88
  1898.       QWIK5XA.ARC   QWIK5X.ARC    TP5        01-03-89
  1899.       QWIKC21.ARC   QWKC21.ARC    TC2/MSC    06-01-89
  1900.  
  1901.  
  1902.    WNDW
  1903.  
  1904.    WNDW - For multi-level virtual windows, WNDW is the highest performance
  1905.    window utilities package available today.  It offers very powerful
  1906.    utilities for full window control and management you probably never thought
  1907.    possible.   They are simple and yet very powerful with high speed and tight
  1908.    code.  With WNDW, you can choose the absolute writing routines of QWIK, the
  1909.    window- relative writing routines of WNDW, and even customize your own.
  1910.    Here are some of the features you will discover:
  1911.  
  1912.    . Uses the powerful direct screen writing routines of QWIK.
  1913.    . Up to 254 fixed or virtual windows can be on the screen at one time.
  1914.    . Extremely high-speed virtual screens in RAM (up to 40 times faster).
  1915.    . Virtual windows are fully updated on screen, even if covered!
  1916.    . Virtual windows have virtual titles.
  1917.    . Fully supported hidden windows saved in RAM.
  1918.    . Fully supports all video pages.
  1919.    . Adjustable-rate moving, resizing, and scrolling.
  1920.    . All windows can be randomly accessed, not just stacked or tiled.
  1921.    . 28 window-relative writing routines.
  1922.    . 15 different border styles with shadow and zoom effects.
  1923.    . Full line drawing procedures.
  1924.    . Full cursor mode control for each window.
  1925.    . Writes in all text modes and column modes.
  1926.    . Only 13k bytes of code if all 69 utilities are used.
  1927.    . Used in all other Eagle products.
  1928.  
  1929.  
  1930.  
  1931.  
  1932.  
  1933.  
  1934.  
  1935.                                        32
  1936.    QWIKC Screen Utilities                           User's Guide, Version 2.1
  1937.  
  1938.  
  1939.    Here are the product versions:
  1940.  
  1941.       File name    CIS filename  Compiler  Release date
  1942.       -----------  ------------  --------  ------------
  1943.       WNDW42.ARC   WNDW42.ARC    TP4/5      10-15-88
  1944.       WNDW5XB.ARC  WNDW5X.ARC    TP5        01-15-88
  1945.       WNDWC21.ARC  WNDC21.ARC    TC2/MSC    TBA
  1946.  
  1947.  
  1948.    PULL
  1949.  
  1950.    PULL - For multi-level pull-down menus, PULL is fully featured and fully
  1951.    configurable.  Includes execute, single, and multiple choice menus,
  1952.    unlimited nested submenus, data entry windows, help windows, directory
  1953.    windows, message system, and fully completed interfaces.  Some of the
  1954.    features are:
  1955.  
  1956.      . Uses QWIK and WNDW.
  1957.      . Work window(s) and complete interface for menus
  1958.      . Pull-down menus with 5 menu modes and 7 line modes
  1959.      . Pull-down file directory
  1960.      . Highlighted command letters
  1961.      . Unlimited levels of submenus
  1962.      . Unlimited data entry windows for 9 types of data
  1963.      . Data entry for the work window(s)
  1964.         Full editing capability including insert cursor mode
  1965.         Full field selection with cursor keys
  1966.         Automatic NumLock for numerical data entry
  1967.         Right or left justification for data entry output
  1968.         Error messages for invalid data entries
  1969.         Error messages for data entries out of range
  1970.      . Automatic sizes and locations for menus.
  1971.      . Operation by cursor keys or command keys
  1972.      . Pull/Pop between work window and nested submenu(s)
  1973.      . Programmable control of pull and pop sequences
  1974.      . Context-sensitive help
  1975.      . Message lines for prompts and processing
  1976.      . Full working shell for user development
  1977.  
  1978.    Here are the product versions:
  1979.  
  1980.       File name    CIS filename  Compiler  Release date
  1981.       -----------  ------------  --------  ------------
  1982.       PULL42.ARC   PULL42.ARC    TP4/5      12-06-88
  1983.       PULL5XB.ARC  PULL5X.ARC    TP5        02-15-89
  1984.       PULLC21.ARC  PULC21.ARC    TC2        TBA
  1985.  
  1986.  
  1987.    ON-LINE SOURCE
  1988.  
  1989.    CompuServe - All updated files and later versions can be found on
  1990.    the CompuServe Borland Forums (GO BPROGA for TP and GO BPROGB for
  1991.    TC) or the IBM Programming Forum (GO IBMPRO).
  1992.  
  1993.  
  1994.  
  1995.  
  1996.                                        33
  1997.    QWIKC Screen Utilities                           User's Guide, Version 2.1
  1998.  
  1999.  
  2000.    A P P E N D I X   E :  R E V I S I O N   H I S T O R Y
  2001.  
  2002.  
  2003.    Version 2.0a (01-02-89):
  2004.      Fixed an oversight which caused videomode, videopage and
  2005.        crtcolumns to be inaccessible in all models except compact and
  2006.        huge.  This occurred because they were not declared as PUBLIC
  2007.        in the QINIT modules.
  2008.  
  2009.    Version 2.0b (02-03-89):
  2010.      Row and Column sizes greater than 127 were not supported unless
  2011.        default char type was set to unsigned.  All row/col parameters
  2012.        and variables are now specified as "unsigned char".
  2013.  
  2014.    Version 2.0c (03-06-89):
  2015.      Remedied qreadattr/char bug which trashed a function's local
  2016.        variables, due to the BP register not being restored correctly.
  2017.      Sped up qvscrtoscr and qstoretoscr by eliminating snow check.
  2018.        A wait-for-retrace was always done in these functions (for the
  2019.        Medium and Compact models only), due to an incorrect
  2020.        addressing method on the qsnow variable.
  2021.      Add setmultitask function to set variables for multitasking
  2022.        video buffers (MTVB).
  2023.      Forced null strings written to virtual buffers to leave qeosofs
  2024.        unchanged.
  2025.  
  2026.    Version 2.0d (03-22-89):
  2027.      Fixed another bug in qreadattr/char which popped SI/DI in the
  2028.        wrong order, thus losing local variables if optimization was
  2029.        turned on.
  2030.      Incorporated SETMULTI.C into the makefiles.
  2031.      Added macros for pointer variables to QWIKSCR.INC and changed
  2032.        QINIT.ASM so as to treat them as macros rather than
  2033.        variables.
  2034.  
  2035. |  Version 2.1 (06-01-89):
  2036. |    Converted to MicroSoft C / QuickC.  SUSPEND routine added,
  2037. |    courtesy of Borland International.  All programs now compile
  2038. |    under TC, MSC, or QC.
  2039.  
  2040.  
  2041.  
  2042.  
  2043.  
  2044.  
  2045.  
  2046.  
  2047.  
  2048.  
  2049.  
  2050.  
  2051.  
  2052.  
  2053.  
  2054.  
  2055.  
  2056.  
  2057.                                        34
  2058.    QWIKC Screen Utilities                           User's Guide, Version 2.1
  2059.  
  2060.  
  2061.    A P P E N D I X   F :   R E F E R E N C E S
  2062.  
  2063.  
  2064.    REFERENCES
  2065.  
  2066.    PS/2 Systems - For more information on the new IBM PS/2 system, you can get
  2067.    the "Personal System/2 and Personal Computer BIOS Interface Technical
  2068.    Reference" manual.  Other references include:
  2069.  
  2070.  
  2071.      IBM Personal System/2 Seminar Proceedings:
  2072.        Volume 5, Number 2, Displays and Adapters, publication
  2073.          # G360-2678.
  2074.        Volume 5, Number 4, Models 50, 60, 80, VGA, BIOS and
  2075.          Programming Considerations, publication # G360-2747.
  2076.  
  2077.    3270 PC - For more information on the IBM 3270 PC, you can get the
  2078.    following publications:
  2079.  
  2080.      "3270 PC Application Development Considerations"
  2081.      "IBM 3270 Personal Computer Programming Guide", Pub # SA23-0221
  2082.      "IBM 3270 Personal Computer Control Program Reference", Pub # GA23-0232
  2083.  
  2084.    As always, the above information is subject to change without notice per
  2085.    IBM.
  2086.  
  2087.    Video Guide - An excellent guide for IBM and Hercules video card
  2088.    programming in text and graphics is:
  2089.  
  2090.      "Programmer's Guide to PC & PS/2 Video Systems" by Richard Wilton
  2091.    and published by Microsoft Press
  2092.  
  2093.    Trademarks - IBM is the trademark for International Business
  2094.    Machines Corp.  Turbo C and Turbo Pascal are trademarks of Borland
  2095.    International.  The SUSPEND routine called in the demonstration and
  2096.    example programs is used by permission of Borland International.
  2097.  
  2098.  
  2099.  
  2100.  
  2101.  
  2102.  
  2103.  
  2104.  
  2105.  
  2106.  
  2107.  
  2108.  
  2109.  
  2110.  
  2111.  
  2112.  
  2113.  
  2114.  
  2115.  
  2116.  
  2117.  
  2118.                                        35
  2119.  
  2120.